﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WisDom.Utils
{
    /// <summary>
    /// 分页参数
    /// </summary>
    public class Pagination
    {
        /// <summary>
        /// 每页行数
        /// </summary>
        public int Take { get; set; }
        /// <summary>
        /// 跳过行数
        /// </summary>
        public int Skip { get; set; }
        /// <summary>
        /// 排序列
        /// </summary>
        public string Sidx { get; set; }
        /// <summary>
        /// 排序类型
        /// </summary>
        public string Sord { get; set; }
        /// <summary>
        /// 总记录数
        /// </summary>
        public int Records { get; set; }
        /// <summary>
        /// 总页数
        /// </summary>
        public int total
        {
            get
            {
                if (Records > 0)
                {
                    return Records % this.Take == 0 ? Records / this.Take : Records / this.Take + 1;
                }
                else
                {
                    return 0;
                }
            }
        } 
    }
}
